<?php
 namespace App\Http\Controllers; use TechOnline\Laravel\Dao\ModelUtil; use TechOnline\Laravel\Http\InputPackage; use TechOnline\Laravel\Http\Request; use TechOnline\Laravel\Http\Response; use TechSoft\Laravel\Config\ConfigUtil; use TechSoft\Laravel\Notice\NoticeUtil; class MessageController extends BaseController { public function index() { $input = InputPackage::buildFromInput(); $update = []; $update['name'] = $input->getTrimString('name'); $update['email'] = $input->getTrimString('email'); $update['phone'] = $input->getTrimString('phone'); $update['content'] = $input->getTrimString('content'); $pass = false; foreach ($update as $item) { if (!empty($item)) { $pass = true; } } if (!$pass) { return Response::send(-1, '所有提交数据为空'); } ModelUtil::insert('message', $update); NoticeUtil::sendConfigNotice('notifyUrlMessage', array_merge(['来源' => Request::domain()], $update)); return Response::send(0, '提交成功', null, '[reload]'); } } 